package Team.Yaohuo.config;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

@Configuration
public class RestTemplateConfig {

    /**
     * 定义restTemplate bean
     * @return
     */
    @Bean
    public RestTemplate restTemplate(){
        SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
        // 增加连接超时时间
        requestFactory.setConnectTimeout(15000);
        // 增加读取超时时间
        requestFactory.setReadTimeout(30000);
        return new RestTemplate(requestFactory);
    }

}
